<template>
	<view class="container">
		<view class="login-header">
			<image class="logo" src="/static/logo.jpg" mode="aspectFit"></image>
			<text class="title">顾客端登录</text>
		</view>
		<view class="login-form">
			<button class="login-btn" @tap="handleLogin">登录</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				phone: '',
				password: ''
			}
		},
		onLoad() {
			// 检查是否已登录
			// 保存登录类型为顾客端
			uni.setStorageSync('loginType', 'customer')
			const userInfo = uni.getStorageSync('userInfo')
			const token = uni.getStorageSync('token')
			if (userInfo && token) {
				// 如果已登录，直接跳转到顾客端首页
				uni.reLaunch({
					url: '/pages/index/index'
				})
			}
		},
		methods: {
			handleLogin() {
				// 保存登录类型为顾客端
				uni.setStorageSync('loginType', 'customer')
				// 跳转到登录页面
				uni.navigateTo({
					url: '/pages/login/login'
				})
			},
			goToTechLogin() {
				uni.navigateTo({
					url: '/pages/login/tech-login'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		min-height: 100vh;
		background: #FFFFFF;
		padding: 60rpx;
	}

	.login-header {
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-bottom: 80rpx;

		.logo {
			width: 200rpx;
			height: 200rpx;
			margin-bottom: 30rpx;
		}

		.title {
			font-size: 40rpx;
			font-weight: 600;
			color: #333;
			letter-spacing: 2rpx;
			margin-top: 20rpx;
			position: relative;
			padding-bottom: 10rpx;

			&::after {
				content: '';
				position: absolute;
				bottom: 0;
				left: 50%;
				transform: translateX(-50%);
				width: 60rpx;
				height: 4rpx;
				background: #007AFF;
				border-radius: 2rpx;
			}
		}
	}

	.login-form {
		.form-item {
			margin-bottom: 40rpx;

			.input {
				width: 100%;
				height: 88rpx;
				background: #F8F8F8;
				border-radius: 44rpx;
				padding: 0 40rpx;
				font-size: 28rpx;
				color: #333;
			}
		}

		.login-btn {
			width: 100%;
			height: 88rpx;
			background: #007AFF;
			border-radius: 44rpx;
			color: #FFFFFF;
			font-size: 32rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			margin-top: 60rpx;
		}

		.other-options {
			margin-top: 40rpx;
			text-align: center;

			.option-text {
				font-size: 28rpx;
				color: #007AFF;
			}
		}
	}
</style>